home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / bbsckit / bbscmisc.c < prev    next >
C/C++ Source or Header  |  1979-12-31  |  2KB  |  74 lines

  1. /*
  2.         bbscmisc.c
  3.  
  4.         Support routines used by BBSc.c.
  5.                                 Mike Kelly
  6.  
  7.         06/12/83 v1.0   written
  8.         07/07/83 v1.0   updated
  9. */
  10.  
  11. #include "bbscdef.h"
  12. #include <sys/types.h>
  13. #include <sys/stat.h>
  14.  
  15. #define LASTDATE  " 07/07/83 "
  16.  
  17. #define PGMNAME "BBSCMISC "
  18. #define VERSION " 1.0 "
  19.  
  20.  
  21. strfill(buf,fillchar,length)    /* fill a string with fillchar */
  22. char    *buf;                   /*  for length -1 */
  23. int     fillchar,
  24.         length;
  25.         {
  26.         while(--length)         /* really is length -1 */
  27.                 {
  28.                 *buf++ = fillchar;
  29.                 }
  30.         *buf++ = '\0';          /* need room for this */
  31.         }
  32.  
  33. substr(from,to,start,length)    /* moves chars from "from" to "to" */
  34. char    *from, *to ;            /*  starting at "start" for */
  35.                                 /*  "length" number of chars */
  36. int     start, length ;         /* for beginning of string use 1, not 0 */
  37.         {
  38.         int     cnt;
  39.  
  40.         cnt = 0;
  41.  
  42.         while(--start)          /* adjust sending field pointer */
  43.                 {
  44.                 from++;         
  45.                 }
  46.  
  47.         while((cnt < length) && (*to++ = *from++))      /* do the moving */
  48.                 {
  49.                 cnt++;          
  50.                 }
  51.         
  52.         *to = '\0';
  53.  
  54.         }
  55.  
  56. char *itoa(str,n)               /* taken from float.c */
  57. char *str;
  58.         {
  59.         char *sptr;
  60.         sprintf(str,"%d",n) ;
  61.         return(str) ;
  62.         }
  63. /*      end of function         */
  64.  
  65. seek(fildes,posit,dummy) int fildes,posit,dummy ;
  66.         {
  67.         return(lseek(fildes,posit << 7,0)) ;
  68.         }
  69. /*      end of function         */
  70.         
  71. /*      end of program          */
  72. sit,dummy) int fildes,posit,dummy ;
  73.         {
  74.         return(lseek(fildes,posit <<